Titanium.include('../general/GeneralVariables.js');
Titanium.include('../general/GeneralFunctions.js');
Titanium.include('../tableViews/CommentTableView.js');

var currentWindow;
var data;

Ti.App.addEventListener('setCommentData', function(){ alert('set comment data'); });

function setCommentData()
{
	table.setData(data[Ti.App.stripIndex]);
}

function _windowSettings()
{
	currentWindow = Titanium.UI.currentWindow;
	_createView(currentWindow.data);
}

function _createView(commentData)
{
	var closeButton = Titanium.UI.createButton({ title: 'sluiten' });
	closeButton.addEventListener('click', function(){
		Ti.App.fireEvent('closeComments');
	});
	currentWindow.rightNavButton = closeButton;
	
	var view = Titanium.UI.createScrollView({contentWidth: 'auto', contentHeight: 'auto', showVerticalScrollIndicator: true});
	var table = _createCommentTable();
	data = _createCommentTableRows(commentData);
	table.setData(data[Ti.App.stripIndex]);
	trace(data[Ti.App.stripIndex]);
	view.add(table);
	currentWindow.add(view);
}

_windowSettings();